///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include <Scripting/ScriptManager.h>
#include <Scripting/Script.h>

//-----------------------------------------------------------------------------

ScriptManager::ScriptManager()
{
}

//-----------------------------------------------------------------------------

ScriptManager::~ScriptManager()
{
	ReleaseScripts();
}

//-----------------------------------------------------------------------------

void		ScriptManager::ReleaseScripts()
{
	std::vector<Script*>::iterator	it;
	for( it = m_scripts.begin(); it != m_scripts.end(); it++ )
	{
		SAFE_DEL( *it );
	}
}

//-----------------------------------------------------------------------------

Script*		ScriptManager::GetScript( std::string name )
{
	Script* scr = MGL_NEW Script();
	if( !scr->Load( name ) )
	{
		DEBUG_ERR( "Could not load '%s' script!", name.c_str() );
		SAFE_DEL( scr );
		return NULL;
	}
	m_scripts.push_back( scr );
	return scr;
}

//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
